<?php
/**
 * 商品API控制器
 * @author 王勇程 <laughskydragon@qq.com>
 */

namespace app\api\controller;

use app\api\controller\ApiBase;

class Product extends ApiBase
{
    /**
     * 获取首页推荐商品
     */
    public function getHomeRecommend()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getHomeRecommend($data);
        return $this->apiReturn($result);
    }
    
    /**
     * 获取商品列表
     */
    public function getProductList()
    {
        return $this->apiReturn($this->logicProduct->getProductList($this->param));
    }
    

    
    /**
     * 获取商品详情
     */
    public function getProductDetail()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getProductDetail($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取商品历史行情
     */
    public function getProductHistory()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getProductHistory($data);
        return $this->apiReturn($result);
    }
    
    /**
     * 搜索商品
     */
    public function searchProduct()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->searchProduct($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取商品分类
     */
    public function getProductCategories()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getProductCategories($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取热门商品
     */
    public function getHotProducts()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getHotProducts($data);
        return $this->apiReturn($result);
    }
    

    


    /**
     * 添加浏览历史
     */
    public function addViewHistory()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->addViewHistory($data);
        return $this->apiReturn($result);
    }

    /**
     * 获取用户浏览历史
     */
    public function getUserViewHistory()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getUserViewHistory($data);
        return $this->apiReturn($result);
    }



    /**
     * 商品详情页综合数据
     * 包含：商品基本信息、价格历史、关注状态、相关推荐、统计数据
     */
    public function getDetailPage()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getDetailPage($data);
        return $this->apiReturn($result);
    }



    /**
     * 商品列表页综合数据
     * 包含：商品列表、分类信息、筛选条件、热门推荐
     */
    public function getListPage()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getListPage($data);
        return $this->apiReturn($result);
    }



    /**
     * 商品搜索页综合数据
     * 包含：搜索结果、热门搜索、搜索建议、相关分类
     */
    public function getSearchPage()
    {
        $data = $this->request->param();
        $result = $this->logicProduct->getSearchPage($data);
        return $this->apiReturn($result);
    }


}